1692C - Where's the Bishop - CodeForces Solution


implementation *800

Please click on ads to support us..

Python Code:

for _ in range(int(input())):
	input()
	s = [input() for _ in range(8)]
	for y in range(1, 7):
		for x in range(1, 7):
			if s[y][x] == '#' and s[y-1][x-1] == '#' and s[y-1][x+1] == '#':
				print(y + 1, x + 1)

C++ Code:

#include<bits/stdc++.h>
#include<iostream>
#include<numeric>
using namespace std;

#define FIXED_FLOAT(x) std::fixed <<std::setprecision(1)<<(x) 
#define rep(i, a, n) for(int i = a; i < n; i++)
const int mod = 1e9+7;//998244353;
const double pi = 3.14159265359;
const int INF = INT_MAX;
#define mily cout<<"Loop is working you shit.\n"
#define pb push_back
typedef long long int ll;
typedef long long unsigned llu;
#define cin(x) for(auto &i: x)  cin>>i
#define cout(v) for(auto &i: v) cout<<i<<" ";
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define LSB(n) (n & -n)
#define en "\n"
#define BINARY(number) bitset<64>(number).to_string().substr(64 - (int)(log2(number)) - 1);
#define FARIA                \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);

//Every  problem is a gift without them we  would not grow
//A person who never made a mistake never tried anythink new
//---I know about the spelling thing :B


void solve(){
    string s;
    int row[8]={0}, col[8]={0};

    for(int i=0; i<8; i++){
        cin >> s;
        for(int j=0; j<8; j++){
            if(s[j]=='#'){
                row[i]++;
                col[i]=j+1;
            }
        }
    }
    for(int i=0; i<6; i++){
        if(row[i]==2 && row[i+1]==1 && row[i+2]==2){
            cout << i+2 << " " << col[i+1] << en;
            return;
        }
    }
    //cout(row); cout << en; cout(col);
    cout << en;
}
    
int main(){ 
    // FARIA;
    int t; cin >> t;
    while(t--){
        //cout << t << " ";
        solve();

    }
       
}


Comments

Submit
0 Comments
More Questions

1365. How Many Numbers Are Smaller Than the Current Number
771. Jewels and Stones
1512. Number of Good Pairs
672. Richest Customer Wealth
1470. Shuffle the Array
1431. Kids With the Greatest Number of Candies
1480. Running Sum of 1d Array
682. Baseball Game
496. Next Greater Element I
232. Implement Queue using Stacks
844. Backspace String Compare
20. Valid Parentheses
746. Min Cost Climbing Stairs
392. Is Subsequence
70. Climbing Stairs
53. Maximum Subarray
1527A. And Then There Were K
1689. Partitioning Into Minimum Number Of Deci-Binary Numbers
318. Maximum Product of Word Lengths
448. Find All Numbers Disappeared in an Array
1155. Number of Dice Rolls With Target Sum
415. Add Strings
22. Generate Parentheses
13. Roman to Integer
2. Add Two Numbers
515. Find Largest Value in Each Tree Row
345. Reverse Vowels of a String
628. Maximum Product of Three Numbers
1526A - Mean Inequality
1526B - I Hate 1111